package com.pgcomb.poweriot.alarmservice.redis;

/**
 * Redis 公用缓存key
 */
public class RedisCacheKey {

    /**
     * 分隔符
     */
    public static final String COMMA = ":";

    /**
     * 5分钟
     */
    public static final Long FIVE_MINUTES = 60 * 5L;

    /**
     * 10分钟
     */
    public static final Long TEN_MINUTES = 60 * 10L;

    /**
     * 20分钟
     */
    public static final Long TWENTY_MINUTES = 60 * 20L;

    /**
     * 30分钟
     */
    public static final Long THIRTY_MINUTES = 60 * 30L;

    /**
     * 1天
     */
    public static final Long ONE_DAY = 60 * 60 * 24L;

    /**
     * 7天
     */
    public static long SEVEN_DAYS = 60 * 60 * 24 * 7L;

    /**
     * 30天
     */
    public static long THIRTY_DAYS = 60 * 60 * 24 * 30L;

    /**
     * 应用信息
     */
    public static final String SERVER = "ALARM_SERVICE";

    /**
     * 告警
     */
    public static final String ALARM = SERVER + COMMA + "ALARM";


    public static String geneCommKeyPrefix(String service, String middleKey) {
        return "{" + service + COMMA + middleKey + COMMA + "}";
    }

    public static String geneCommKey(String service, String middleKey, String outerId) {
        return geneCommKeyPrefix(service, middleKey) + outerId;
    }


    /**
     * 获取告警key
     *
     * @param key
     * @return
     */
    public static String getAlarmKEY(String key) {
        return geneCommKey(SERVER, ALARM, key);
    }


}
